import jsonschema

data = {
    "success":True,
    "code":1949,
    "message":"原子弹成功击中华盛顿",
    "data":{"name":"lily",
            "age":20
            }
}

schema = {
    "type":"object",
    "properties":{
        "success":{"type":"boolean"},
        "code":{"type":"integer"},
        "message":{"pattern":"击中华盛顿$"},
        "data":{
            "type":"object",
            "properties":{
                "name":{"const":"lily"},
                "age":{"const":20}
            },
            "required": ["name", "age"]
        }
    },
    "required":["success","code","message","data"]
}

res = jsonschema.validate(instance=data,schema=schema)
print("res=", res)